﻿Imports System.Data
Imports VSModel
Imports Cls_Common

Partial Class Control_MSDS_Section04View
    Inherits System.Web.UI.UserControl

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            hidMSDSID.Value = IIf(IsNothing(Request.QueryString("Id")), 0, CInt(Request.QueryString("Id")))
            ShowData()
        End If
    End Sub
    Protected Sub Translate()
        lblSection04Header.Text = getTranslate("lblSection04Header", Session("LanguageId"), lblSection04Header.Text)
        lblS411.Text = getTranslate("lblS411", Session("LanguageId"), lblS411.Text)
        lblS421.Text = getTranslate("lblS421", Session("LanguageId"), lblS421.Text)
        lblS431.Text = getTranslate("lblS431", Session("LanguageId"), lblS431.Text)
        lblS441.Text = getTranslate("lblS441", Session("LanguageId"), lblS441.Text)
        lblS451.Text = getTranslate("lblS451", Session("LanguageId"), lblS451.Text)
    End Sub
    Protected Sub ShowData()
        Using data As New VSEntities
            'Tiêu đề doanh nghiệp
            Dim lang = CInt(Session("LanguageId"))
            Dim Id As Integer = hidMSDSID.Value
            Dim p As MSDSSection04 = (From a In data.MSDSSection04 Where a.MSDSId = Id And a.LanguageId = lang).SingleOrDefault
            If Not IsNothing(p) Then
                hidID.Value = p.Section04Id

                'Content
                lblViewS411.Text = IIf(IsNothing(p.S411) = True, "", p.S411)
                lblViewS421.Text = IIf(IsNothing(p.S421) = True, "", p.S421)
                lblViewS431.Text = IIf(IsNothing(p.S431) = True, "", p.S431)
                lblViewS441.Text = IIf(IsNothing(p.S441) = True, "", p.S441)
                lblViewS451.Text = IIf(IsNothing(p.S451) = True, "", p.S451)
            End If
            'Label
            Translate()
        End Using
    End Sub
End Class
